You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When an app (like WhatsApp) adds custom fields to the room, it issues an update via bridge with just the necessary data (in this case, the _id and customFields props).
When the apps engine receives this, it triest to convert that into a rocketchat room object, assuming some properties are there. Since, in this case, the name was not in the original update, then it defaulted to undefined, leaving the update statement with something like:
{ _id: 'xxx', customFields: {}, name: undefined }
Previously, the driver would ignore those undefined fields, but now we're passing them into the query. This caused the room to be name: undefined in the database (apart from other fields, like the room's type!)
Then, when another update or another query to the room was made, the app wasn't able to find the room it creatd (as it lacked the type l for livechat) and it attempted to create a new one. Then, when it added the custom fields, the same would happen, but this time, it would conflict with the previous room as both would have name: undefined on the database (and name should be unique).
This would throw a Duplicated Index Key error, which the apps engine would fail to parse, causing the whole operation to fail and the gateway to reschedule the message...
Further comments
Caused by #31497
(Or at least, this one made it surface :p )
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
This PR includes no changesets
When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed changes (including videos or screenshots)
Issue(s)
https://rocketchat.atlassian.net/browse/CTZ-86
Steps to test or reproduce
When an app (like WhatsApp) adds custom fields to the room, it issues an update via bridge with just the necessary data (in this case, the _id and customFields props).
When the apps engine receives this, it triest to convert that into a rocketchat room object, assuming some properties are there. Since, in this case, the
namewas not in the original update, then it defaulted toundefined, leaving the update statement with something like:Previously, the driver would ignore those undefined fields, but now we're passing them into the query. This caused the room to be
name: undefinedin the database (apart from other fields, like the room'stype!)Then, when another update or another query to the room was made, the app wasn't able to find the room it creatd (as it lacked the type
lfor livechat) and it attempted to create a new one. Then, when it added the custom fields, the same would happen, but this time, it would conflict with the previous room as both would havename: undefinedon the database (and name should be unique).This would throw a Duplicated Index Key error, which the apps engine would fail to parse, causing the whole operation to fail and the gateway to reschedule the message...
Further comments
Caused by #31497
(Or at least, this one made it surface :p )